/*
 * @FileName: bsp_adc.h
 * @Author: GreyQiu qiushaogui@aikosolar.com
 * @Date: 2023-07-12 16:05:59
 * @LastEditors: GreyQiu qiushaogui@aikosolar.com
 * @LastEditTime: 2023-09-23 13:07:40
 * @Description: 
 * 
 * Copyright (c) 2023, All Rights Reserved. 
 */

#ifndef __BSP_ADC_H__
#define __BSP_ADC_H__

#include "n32g430.h"
#include "log.h"

/**
 * @description: 各个信号采样ADC通道定义
 */
#define BSP_ADC_CH_VAC          ADC_Channel_04_PA3 // 输入电压

#define ADC_SAMPLE_TIME1   ADC_SAMP_TIME_41CYCLES5 // ADC通道采样时间 TCONV = （7.5 + 12.5）/ 64Mhz = 0.3125us

#define ADC_INJECT_CH_NUM       (1) // 通道个数

/**
 * @description: 注入通道定义
 */
#define ADC_CH_NUM_VAC      ADC_INJECTED_NUMBER_4

/**
 * @description: 各个信号AD值地址
 */
#define ADC_RESULT_ADDR_VAC      (&(g_adcBuffer[0]))

extern volatile int16_t g_adcBuffer[ADC_INJECT_CH_NUM];

#define BSP_ADC_GET_TEMP1()  (g_adcTempBuffer[0])
#define BSP_ADC_GET_TEMP2()  (g_adcTempBuffer[1])

void bsp_adc_init(void);
void bsp_adc_temp_trig(void);

#endif /* __BSP_ADC_H__ */
